import { IsNotEmpty, IsString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { Expose } from 'class-transformer';

export class LoginInputDto {
  @IsString({ message: '登录名称必须是 String 类型' })
  @IsNotEmpty({ message: '登录名称不能为空' })
  @ApiProperty({
    description: '登录名称',
    example: 'beat',
  })
  readonly username: string;

  @IsString({ message: '登录密码必须是 String 类型' })
  @IsNotEmpty({ message: '登录密码不能为空' })
  @ApiProperty({
    description: '登录密码',
    example: '123456',
  })
  readonly password: string;
}

export class LoginOutputDto {
  @Expose()
  @IsString()
  @ApiProperty()
  token: string;

  @Expose()
  @IsString()
  @ApiProperty()
  refresh_token?: string;
}
